<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>layui</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="__static/lib/layui-v2.5.5/css/layui.css" media="all">
	<link rel="stylesheet" href="__static/css/public.css" media="all">
	<script src="__static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="__static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
	<style>
		.layui-form-pane .layui-form-label {
			width: 90px;
		}
		
	</style>
</head>
<body>
<div class="layuimini-container">
	<div class="layuimini-main">
		<fieldset class="table-search-fieldset">
			<legend>搜索信息</legend>
			<form class="layui-form layui-form-pane" action="">
				<div class="layui-form-item" style="margin-bottom: 5px;">
					<div class="layui-inline">
						<div class="layui-input-inline">
							<select name="channel_id" lay-search="" autocomplete="off">
								<option value="" >直接选择端口</option>
								{volist name="ch_list" id="vo"}
									<option value="{$vo.id}" >{$vo.name}</option>
								{/volist}
					        </select>
						</div>
					</div>
					<div class="layui-inline">
						<div class="layui-input-inline">
							<input type="text" name="time" id="date" placeholder="请选择时间" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
					</div>
				</div>
			</form>
		</fieldset>

		<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
        <script type="text/html" id="toolbar">
            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="acc_recharges"> 打款 </button>
            </div>
        </script>
		<script type="text/html" id="currentTableBar">
			<!-- <a style="{{d.status==-1?'display:none':''}}{{d.status == 1?'display:none;':''}}" class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="cashier">出纳</a>
			<a style="{{d.status==-1?'display:none':''}}{{d.status == 1?'display:none;':''}}" class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">驳回</a>
			<a style="{{d.status == 1?'':'display:none;'}}" class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="rollback">回滚</a> -->
			
		</script>
		<script type="text/html" id="typeTable">
			<span  style="color: #03A9F4;font-weight: bold;{{d.type == 1?'':'display:none;'}}">打款</span>
            <span  style="color: #5FB878;font-weight: bold;{{d.type == 2?'':'display:none;'}}">充值</span>
            <span  style="color: #FF5722;font-weight: bold;{{d.type == 3?'':'display:none;'}}">退款</span>
		</script>
		
	</div>
</div>

<script>
//出纳确认
function get_recharges(id){
	layer.open({
        type: 2,
        title:'打款',
        area: ['50%', '70%'],
        fixed: false, //不固定
        maxmin: true,
        shadeClose:false,	//点击遮罩后关闭提示框
        scrollbar:false, //- 是否允许浏览器出现滚动
        content: "{:url('add_channel_recharge')}"
    });
    //layer.full(index);
} 

	var form,table,laydate
	layui.use(['form', 'table', 'tableSelect', 'laydate'], function () {
		$ = layui.jquery , form = layui.form , table = layui.table , laydate = layui.laydate
		laydate.render({
		    elem: '#date' //指定元素
			,range: '&'
		  });
		table.render({
			elem: '#currentTableId',
			height: 'full-150',
			id:'acc_re_info',
			url: '{:url("finance/channel", ["t"=>"json"])}',
			method : 'post',
            toolbar: '#toolbar',
			cols: [[
				{ field: 'create_time', title: '日期' ,fixed: 'left'},
                { field: 'type', title: '操作类型' ,fixed: 'left',toolbar:'#typeTable' },
                { field: 'name_id', title: '账户ID' ,fixed: 'left'},
                { field: 'channel_name', title: '端口'},
				{ field: 'rebate', title: '端口返点(%)'},
				{ field: 'currency', title: '账户币' , style:'color: red;font-weight: bold;'},
				{ field: 'amount', title: '金额' , style:'color: #1e9fff;font-weight: bold;'},
				{ field: 'b_amount', title: '备款(现金)', totalRow: true},
                { field: 'b_currency', title: '备款账户币', totalRow: true},
				{ field: 'yue_amount', title: '余额(元)', style:'color: #1e9fff;font-weight: bold;'},
				{ field: 'yue_currency', title: '余额(币)', style:'color: red;font-weight: bold;'},
				{ field: 'note', title: '备注',width:160 },
			]],
			
			limit: 30,
			page: true,
			skin: 'line',
			
		});
        /**
		 * toolbar监听事件
		 */
		table.on('toolbar(currentTableFilter)', function (obj) {
			switch (obj.event) {
				case 'acc_recharges':
					//打款
					get_recharges();
				break;
			}
			
		});
		//监听操作栏事件
		table.on('tool(currentTableFilter)', function (obj) {
			var data = obj.data;
			switch (obj.event) {
				case 'cashier':
					get_cashier(data.id);
				break;
				case 'delete':
					get_bohui(data.id);
				break;
				case 'rollback':
					get_rollback(data.id);
				break;
			}
			
		});
		//监听行单击事件
		table.on('row(currentTableFilter)', function(obj){
			  layer.photos({
				  photos: obj.tr
				  ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
				});
			});
		
		
		//搜索
		form.on('submit(data-search-btn)', function(data){
			var articleFrom = data.field;
			table.reload('acc_re_info', {
			  	url: '{:url("finance/channel", ["t"=>"json"])}',
				where:articleFrom
			});
			return false;
		  });
	});
	//重载数据表
	function get_apply(msg){
		table.reload('acc_re_info', {
			  url: '{:url("finance/channel", ["t"=>"json"])}',
			});
		layer.msg(msg, {icon: 6});
	}
</script>

</body>
</html>